<?php echo $this->fetch('header.html'); ?>
<script type="text/javascript">
    $(function () {
        $('#add_time_from').datepicker({dateFormat: 'yy-mm-dd'});
        $('#add_time_to').datepicker({dateFormat: 'yy-mm-dd'});
    });
</script>

<div id="rightTop">
    <ul class="subnav" style="margin:0;">
        <li><span>财务对账</span></li>
        
    </ul>
</div>

<div class="mrightTop">
    <div class="fontl">
        <form method="get">
            <div class="left">
                <input name="app" type="hidden" id="app" value="account_check" />
                <input name="act" type="hidden" id="act" value="index" />
                用户名:
                <input class="queryInput" type="text" name="user_name" value="<?php echo htmlspecialchars($this->_var['query']['user_name']); ?>" />
                时间从:<input class="queryInput pick_date" type="text" value="<?php echo $this->_var['query']['add_time_from']; ?>" id="add_time_from" name="add_time_from" />
                到:<input class="queryInput pick_date" type="text" value="<?php echo $this->_var['query']['add_time_to']; ?>" id="add_time_to" name="add_time_to" />
                状态:<select name='wrong'>
                    <option value="-1" <?php if ($_GET['wrong'] == '-1'): ?>selected<?php endif; ?>>请选择...</option>
                    <option value="0" <?php if ($_GET['wrong'] == '0'): ?>selected<?php endif; ?>>正确</option>
                    <option value="1" <?php if ($_GET['wrong'] == '1'): ?>selected<?php endif; ?>>错误</option>
                    <option value="2" <?php if ($_GET['wrong'] == '2'): ?>selected<?php endif; ?>>已修正</option>
                </select>
                <input type="submit" class="formbtn" value="查询" />
            </div>
            <?php if ($this->_var['filtered']): ?>
            <a class="left formbtn1" href="index.php?app=account_check">撤销检索</a>
            <?php endif; ?>
            <a class="left formbtn1" href="javascript:drop_confirm('生成时间会比较长，确认要批量生成账单吗？','index.php?app=account_check&act=gen')">批量生成</a>
        </form>
    </div>
    <div class="fontr">
        <?php echo $this->fetch('page.top.html'); ?>
    </div>
</div>

<div class="tdare">
<div style="padding:10px">
1.当距上次检查时已完成收入+距上次检查时未完成收入+上次检查时的可用余额+上次检查时的冻结余额=现可用余额+现冻结余额+距上次检查时已完成支出+距上次检查时未完成支出 时结果正确<br>
2.未完成收入为日志类型为出售商品的未完成预存款记录<br>
3.未完成支出为日志类型为购买商品的未完成预存款记录<br>
4.只有修正错误结果后才能生成下一次账单<br>
5.每次账单最短间隔为1天<br>
</div>
    <table width="100%" cellspacing="0">

        <tr class="tatr1">
            <td>用户名</td>
            <td>已完成收入</td>
            <td>未完成收入</td>
            <td>上次可用余额</td>
            <td>上次冻结余额</td>
            <td>已完成支出</td>
            <td>未完成支出</td>
            <td>现可用余额</td>
            <td>现冻结余额</td>
			<td>结果正确</td>
            <td>计算时间</td>
            <td>操作</td>
        </tr>

        <?php $_from = $this->_var['account_check_list']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('key', 'account_check');if (count($_from)):
    foreach ($_from AS $this->_var['key'] => $this->_var['account_check']):
?>
        <tr class="tatr2">
            <td><b><?php echo $this->_var['account_check']['user_name']; ?></b></td>
            <td><font color='blue'><?php echo $this->_var['account_check']['income']; ?></font></td>
            <td><font color='blue'><?php echo $this->_var['account_check']['income_temp']; ?></font></td>
            <td><font color='blue'><?php echo ($this->_var['account_check']['begin_money'] == '') ? '0' : $this->_var['account_check']['begin_money']; ?></font></td>
            <td><font color='blue'><?php echo ($this->_var['account_check']['begin_money_dj'] == '') ? '0' : $this->_var['account_check']['begin_money_dj']; ?></font></td>
            <td><font color='red'><?php echo $this->_var['account_check']['outlay']; ?></font></td>
            <td><font color='red'><?php echo $this->_var['account_check']['outlay_temp']; ?></font></td>
			<td><font color='red'><?php echo $this->_var['account_check']['money']; ?></font></td>
			<td><font color='red'><?php echo $this->_var['account_check']['money_dj']; ?></font></td>
			<td><?php if ($this->_var['account_check']['wrong'] == '1'): ?><font color='orange'>否</font><?php elseif ($this->_var['account_check']['wrong'] == '2'): ?><font color='gray'>已修正</font><?php else: ?><font color='green'>是</font><?php endif; ?></td>
            <td><?php echo local_date("y-m-d H:i:s",$this->_var['account_check']['add_time']); ?></td>
            <td><?php if ($this->_var['account_check']['wrong'] == '1'): ?>
            <a href="<?php echo url('app=account_check&id=' . $this->_var['account_check']['id']. '&act=edit'); ?>">修正</a>&nbsp;|&nbsp;
            <?php endif; ?>
            <?php if ($this->_var['account_check']['wrong'] == '2'): ?>
            <a href="<?php echo url('app=account_check&id=' . $this->_var['account_check']['id']. '&act=fix'); ?>">记录</a>&nbsp;|&nbsp;
            <?php endif; ?>
            <a href="<?php echo url('app=account_log&user_id=' . $this->_var['account_check']['user_id']. '&check_id=' . $this->_var['account_check']['id']. ''); ?>">检查</a></td>
        </tr>
        <?php endforeach; else: ?>
        <tr class="no_data">
            <td colspan="8">没有符合条件的记录</td>
        </tr>
        <?php endif; unset($_from); ?><?php $this->pop_vars();; ?>
    </table>
    <?php if ($this->_var['account_check_list']): ?>
    <div id="dataFuncs">
        <div class="pageLinks"><?php echo $this->fetch('page.bottom.html'); ?></div>
        <div class="clear"></div>
    </div>
    <?php endif; ?>
</div>
<?php echo $this->fetch('footer.html'); ?>